public class Solution1784 {
    public boolean checkOnesSegment(String s) {
        int block=0;
        for (int i=0;i<s.length();i++){
            if (s.charAt(i)=='1'){
                block++;
            }
            while (i<s.length() && s.charAt(i)=='1'){
                i++;
            }
        }
        return block<=1;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1784().checkOnesSegment("1001"));
    }
}
